import { defineStore } from "pinia";
import {
  getSongListApi,
  getLiRongHaoAip,
} from "@/api/discoverMusic/songPlaying";

export const useSongPlaying = defineStore({
  id: "settings",

  state: (): any => ({
    songList: {
      id: 0,
      url: "",
      time: 0,
    },

  }),

  actions: {

    //根据id获取歌曲播放地址
    async getsongList(id: number) {
      const res = await getSongListApi(id);
      this.songList.id = res.data[0].id;
      this.songList.time = res.data[0].time;
      this.songList.url = res.data[0].url;
    },
  },
});
